import React from 'react';
import {Provider} from 'react-redux';
import {renderRoutes} from 'react-router-config';
import {PersistGate} from 'redux-persist/lib/integration/react';
import {BrowserRouter} from 'react-router-dom';

import './App.css';
import routes from '@/common/routes'
import store, {persistor} from '@/common/store'

const subscribe = store.subscribe(() => {
  console.log('subscribe ------------')
  console.log(store.getState())
})

subscribe();

function App() {
  return (
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <div className="App">
          <BrowserRouter>
            {renderRoutes(routes)}
          </BrowserRouter>
        </div>
      </PersistGate>
    </Provider>
  );
}

export default App;
